package test_gui01;

import java.awt.*;
import java.awt.event.*;

import javax.swing.*;

import java.util.*;
import java.text.*;
import java.util.Timer;

public class TimeFrame extends JFrame implements ActionListener
{
  JLabel label;
  SimpleDateFormat sdf = new SimpleDateFormat( "dd MMM yyyy hh:mm:ss" );
  public TimeFrame()
  {
    super( "Time Frame" );
    setSize( 500, 500 );
    label = new JLabel( sdf.format( new GregorianCalendar().getTime() ) );
    label.setHorizontalAlignment( JLabel.RIGHT );
    Container cont = getContentPane();
    cont.add( label, BorderLayout.SOUTH );
    //Timer timer = new Timer(500.tt);
    //timer.start();
    
    
    JLabel jLabel2 = new JLabel();
    jLabel2.setText("StatusBar:");

    JPanel contentPane = (JPanel)this.getContentPane();
    contentPane.setLayout(new BorderLayout(0, 0));
    contentPane.add(jLabel2, BorderLayout.SOUTH); 
    
    JFrame frame = new JFrame();
    frame.setLayout(new BorderLayout());
    frame.setSize(200, 200);

    // create the status bar panel and shove it down the bottom of the frame
    JPanel statusPanel = new JPanel();
    statusPanel.setBorder(new BevelBorder(BevelBorder.LOWERED));
    frame.add(statusPanel, BorderLayout.SOUTH);
    statusPanel.setPreferredSize(new Dimension(frame.getWidth(), 16));
    statusPanel.setLayout(new BoxLayout(statusPanel, BoxLayout.X_AXIS));
    JLabel statusLabel = new JLabel("status");
    statusLabel.setHorizontalAlignment(SwingConstants.LEFT);
    statusPanel.add(statusLabel);

    frame.setVisible(true);
    
    
    
  }
  public void actionPerformed( ActionEvent ae )
  {
    label.setText( sdf.format( new GregorianCalendar().getTime() ) );
  }
  public static void main(String[] args) 
  {
    TimeFrame tf = new TimeFrame();
    tf.setVisible( true );
  }
}